package ca.newcommerce.youtube.iterators
{
    import ca.newcommerce.youtube.data.*;

    public class CategoryIterator extends Object
    {
        protected var _feedPointer:Object = -1;
        protected var _data:Array;

        public function CategoryIterator(param1:Array)
        {
            this._data = param1;
            return;
        }// end function

        public function getAt(param1:Number) : CategoryData
        {
            if (param1 >= 0 && param1 < this.count)
            {
                return new CategoryData(this._data[param1]);
            }
            return null;
        }// end function

        public function get keywords() : Array
        {
            var _loc_3:CategoryData = null;
            var _loc_1:* = this._feedPointer;
            this._feedPointer = -1;
            var _loc_2:Array = [];
            do
            {
                
                if (_loc_3.scheme == "keywords")
                {
                    _loc_2.push(_loc_3.term);
                }
                var _loc_4:* = this.next();
                _loc_3 = this.next();
            }while (_loc_4)
            this._feedPointer = _loc_1;
            return _loc_2;
        }// end function

        public function get categorywords() : Array
        {
            var _loc_3:CategoryData = null;
            var _loc_1:* = this._feedPointer;
            this._feedPointer = -1;
            var _loc_2:Array = [];
            do
            {
                
                if (_loc_3.scheme == "categories")
                {
                    _loc_2.push(_loc_3.label);
                }
                var _loc_4:* = this.next();
                _loc_3 = this.next();
            }while (_loc_4)
            this._feedPointer = _loc_1;
            return _loc_2;
        }// end function

        public function get count() : Number
        {
            return this._data.length;
        }// end function

        public function last() : CategoryData
        {
            this._feedPointer = this.count - 1;
            return this.getAt(--this.count);
        }// end function

        public function first() : CategoryData
        {
            var _loc_1:int = 0;
            this._feedPointer = 0;
            return this.getAt(_loc_1);
        }// end function

        public function next() : CategoryData
        {
            var _loc_1:String = this;
            _loc_1._feedPointer = this._feedPointer + 1;
            return this.getAt(++this._feedPointer);
        }// end function

        public function previous() : CategoryData
        {
            var _loc_1:String = this;
            _loc_1._feedPointer = this._feedPointer - 1;
            return this.getAt(--this._feedPointer);
        }// end function

    }
}
